/////////////////////////////////////////////     File     //////////////////////////////////////////////////
// Author: James Chen
// Filename: Grass.h
// Created: Thursday, August 26, 2010 10:22:27 PM
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma once

#include "CUtilities.h"
#include "Field.h"
#include "Vertex.h"

/////////////////////////////////////////////     Class     /////////////////////////////////////////////////
// Name: CGrass
// Author: James Chen
// Created: Thursday, August 26, 2010 10:22:27 PM
//
// Purpose: Grass for the field
//
// Revisions: 
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
class CGrass
{
	////////////////////// Singleton Implementation Begins //////////////////////
private:

	D3DXVECTOR3 m_vecPosition;

	D3DXVECTOR2 m_vecXBounds;
	D3DXVECTOR2 m_vecZBounds;

	D3DXVECTOR2 m_vecGrassHeight;
	
	DWORD mNumVertices;
	DWORD mNumFaces;

	float m_fFieldHeight;
	float m_fBladeWidth;

	unsigned int m_uiPatches;
	unsigned int m_uiBlades;

	ID3D10Device* md3dDevice;
	ID3D10Buffer* mVB;
	ID3D10Buffer* mIB;

	CGrass(void);
	CGrass(const CGrass&);
	CGrass& operator =(const CGrass&);
	static CGrass *m_pInstance;

public:

	virtual ~CGrass(void);
	static CGrass *GetInstance(void);
	static void DeleteInstance(void);
	/////////////////////// Singleton Implementation Ends ///////////////////////

	void init(ID3D10Device* device);
	void draw();

	D3DXVECTOR3 GetTargetPosition();

	void SetPosition(D3DXVECTOR3 &pos);
	void SetGrassHeight(float &min, float &max);
	void SetBladeWidth(float &width);

	void BuildVertexBuffer(Vertex *vertex);

};

/*---------------------------------------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------------------------------------*/

